<!DOCTYPE html>
            
<HTML>
<HEAD>
<meta name="booktitle" content="Developing Applications With Objective Caml" >
 <meta charset="ISO-8859-1"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<META name="GENERATOR" content="hevea 1.05-7 of 2000-02-24">
<META NAME="Author" CONTENT="Christian.Queinnec@lip6.fr">
<LINK rel=stylesheet type="text/css" href="videoc-ocda.css">
<script language="JavaScript" src="videoc.js"><!--
//--></script>
<TITLE>
 To Learn More
</TITLE>
</HEAD>
<BODY class="regularBody">
<A HREF="book-ora042.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="book-ora044.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2> To Learn More</H2>
The principal consequences of adding imperative traits to a functional
language are: 
<UL>
<LI>
  To determine the evaluation strategy (strict evaluation); 
 
<LI> to add implementation constraints, especially for the GC (see
 Chapter <A HREF="index.html#chap-GC">9</A>);
 
<LI> For statically typed languages, to make their type system more
 complex; 
 
<LI> To offer different styles of programming in the same language,
 permitting us to program in the style appropriate to the
 algorithm at hand, or possibly in a mixed style. 
</UL>
This last point is important in Objective CAML where we need the same
parametric polymorphism for functions written in either style. For
this, certain purely functional programs are no longer typable after
the addition. Wright's article ([<A HREF="book-ora214.html#Wright93"><CITE>Wri95</CITE></A>]) explains the
difficulties of polymorphism in languages with imperative aspects.
Objective CAML adopts the solution that he advocates. The classification of
different kinds of polymorphism in the presence of physical
modification is described well in the thesis of Emmanuel Engel
([<A HREF="book-ora214.html#Engel98"><CITE>Eng98</CITE></A>]).<BR>
<BR>
These consequences make the job of programming a bit harder, and
learning the language a bit more difficult. But because the
language is richer for this reason and above all offers the choice of
style, the game is worth the candle. For example, strict evaluation is
the rule, but it is possible to implement basic mechanisms for lazy
evaluation, thanks to the mixture of the two styles. Most purely
functional languages use a lazy evaluation style. Among languages
close to ML, we would mention Miranda, LazyML, and
Haskell. The first two are used at universities for teaching and
research. By contrast, there are significant applications written in
Haskell. The absence of controllable side effects necessitates an
additional abstraction for input/output called monads. One can
read works on Haskell (such as [<A HREF="book-ora214.html#Thompson"><CITE>Tho99</CITE></A>]) to learn more about
this subject. Streams are a good example of the mixture of functional
and imperative styles. Their use in lexical and syntactic analysis is
described in Chapter <A HREF="index.html#chap-AlexS">11</A>.

<BR>
<BR>

<BR>
<BR>
<HR>
<A HREF="book-ora042.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="book-ora044.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
